Mysql 安装

 Mysql安装地址

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//下载mysql-apt-config_0.8.13-1_all.deb 到Linux 

$apt-get update

$mkdir mysql

$cd mysql

//安装
$apt-get install mysql-server

//查看Mysql服务状态
$ service mysql status

//重启Mysql
$service mysql restart

//查看Mysql端口占用
$netstat -tunlp | grep 3306

//进行安装初始化设置密码等操作
$ mysql_secure_installation

//设置 Linux服务器数据库可以在任意服务器上远程连接
$ mysql -u root -p
mysql> show databases;
mysql> use mysql;
mysql> select host, user from user;
mysql> update user set host = '%' where user = 'root';
mysql> flush privileges;
mysql> exit;


从命令行终端运行此命令,将在寻找Linux/BSD / OS X系统中的MySQL配置文件 my.cnf 文件:

mysql --help | grep 'Default options' -A 1
上面命令执行后,会有这样的输出:

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf
/usr/local/etc/my.cnf
~/.my.cnf
/etc/mysql/mysql.conf.d mysql配置文件
现在,可以检查你正在使用的 my.cnf 文件是否存在。在 Mac OS X 中默认式没有 my.cnf 文件的。你可以从这个地方复制一份过去 /usr/local/mysql/support-files/my-default.cnf 每个版本都不一样,你只需要找到一个 .cnf